import { createRouter, createWebHistory } from 'vue-router'
import {constantRoutes} from './module/index'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
NProgress.configure({ showSpinner: false })

const router = createRouter({
  history: createWebHistory(),
  routes:constantRoutes,
})
/**
 * Router 前置拦截
 * @param to 目标
 * @param from 来至 
 */
router.beforeEach((to,from, next) => {
  NProgress.start();
  next();
})
router.afterEach(() => {
  NProgress.done();
})

export default router